const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {
  CleanWebpackPlugin
} = require('clean-webpack-plugin');


module.exports = {
  mode: "production",
  optimization: {
    minimize: false
  },
  // 打包源文件
  entry: path.resolve(__dirname, "./src/app.ts"),
  devtool: 'inline-source-map',
  devServer: {
    contentBase: './dist'
  },
  resolve: {
    extensions: ['.ts']
  },
  // 打包输出
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bundle.js",
    environment: {
      arrowFunction: false
    }
  },
  // 模块编译插件
  module: {
    rules: [{
      test: /\.ts$/,
      use: {
        loader: 'ts-loader'
      },
      exclude: /node_modules/
    }]
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      title: 'WebpackPlugin~'
    }),
  ]

};